﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using DAO;
using System.Data;

namespace BUS
{
    public class BaoTapChiBUS
    {
        #region 1. Them
        public static bool ThemBaoTC(BaoTapChiDTO baotc){
            if (!NhaXuatBanDAO.CheckNXBByID(baotc.MaNXB))
            {
                return false;
            }
            return BaoTapChiDAO.ThemBaoTapChi(baotc);
        }
        #endregion
        #region 2. Sua
        public static bool SuaBaoTC(BaoTapChiDTO baotc){
            if (!NhaXuatBanDAO.CheckNXBByID(baotc.MaNXB))
            {
                return false;
            }
            return BaoTapChiDAO.SuaBaoTapChi(baotc);
        }
        #endregion
        #region 3. Xoa
        public static bool XoaBaoTC(String mabtc){
            return BaoTapChiDAO.XoaBaoTapChi(mabtc);
        }
        #endregion
        #region 4. Tim kiem
        public static BaoTapChiDTO TimBaoTC(String mabtc){
            if (!BaoTapChiDAO.CheckBaoTapChiBangID(mabtc))
            {
                return null;
            }
            return BaoTapChiDAO.TimBaoTapChiBangID(mabtc);
        }
        public static DataTable TimTatCaBaoTC()
        {
            return BaoTapChiDAO.TimTatCaBaoTapChi();
        }
        public static List<BaoTapChiDTO> TimBaoTCByNhaXB(String manxb){
            if (!NhaXuatBanDAO.CheckNXBByID(manxb))
            {
                return null;
            }
            return BaoTapChiDAO.TimBaoTapChiBangMaNXB(manxb);
        }
        #endregion
    }
}
